package com.sinosoft.hydra.um.commons;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.sinosoft.hydra.um.domain.permission.SysResource;
/**
 * 该类主要封装了对JDBC查询结果的封装
 * <p>仅限于jdbc查询资源表(sys_resource)表使用
 * @version v0.5-alpha
 * @author <a href="mailto:oujianlin@sinux.com.cn">oujianlin@sinux.com.cn</a>
 */
public class ResourceRowMapper implements RowMapper<SysResource> {


	public SysResource mapRow(ResultSet rs, int rowNum) throws SQLException {
		SysResource sr=null;
		try {
			sr = new SysResource();
			sr.setId(rs.getString("id"));
			sr.setResourceName(rs.getString("RESOURCE_NAME"));
			sr.setResourceType(rs.getString("RESOURCE_TYPE"));
			sr.setPermission(rs.getString("PERMISSION"));
			sr.setResourceUrl(rs.getString("RESOURCE_URL"));
			sr.setAvailable(rs.getInt("AVAILABLE"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return sr;
	}

}
